
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    
<%@page import="gruppe7.util.Html" %>
<%@page import="gruppe7.model.User" %>
<%@page import="gruppe7.model.Model" %>
<%@page import="gruppe7.control.ServletController" %>

<%
Html html = new Html(); 
ServletController sc = ServletController.getInstance();
User user = sc.getSession(request, response).getUser();
Model model = Model.getInstance();

out.print(html.setHeader("Show accounts")); 

%>

<body>
<jsp:include page="main_links.jsp" />

<div id ='content'>
<div id='content-left'>
<h3><img src='images/tickets.png'/> Show accounts</h3><br/> 

<%
if (user.isAdminUser()) {
	User[] users = model.getAllUsers();
	
	for (User sysUser : users) {
		float balance = model.getUserBalance(sysUser);
		out.println(sysUser.getUsername() + ":" + balance);
	}
}

else {
	out.println("You have to be an administrator to use this feature");
}

%>

</div></div>

<%
out.println(html.setFooter());
%>